import type {
  AccountDetail,
  AccountTypeNameResponse,
  CloseNoticeRequest,
  DataCount,
  DelGoodRequest,
  DropAccountRequest,
  GetAllUserByGroupResponse,
  GetCalendarDataRequest,
  GetCalendarDataResponse,
  GetDaKaCalendarDataRequest,
  GetGoodDetailRequest,
  GetGoodsTypeResponse,
  GetGroupRequest,
  GetNoticeRequest,
  GetNoticeResponse,
  GetSameAccountRequest,
  GetSameAccountResponse,
  GetUserAccountRequest,
  GetUserSettingRequest,
  ShowYuSuanRequest,
  ShowYuSuanResponse,
  UpdateGoodRequest,
  UserAccount,
  UserSetting,
} from '@/types/detail'
import type { Base2UserGroupRequest, BaseRequest } from '@/types/job'
import type { LoginResult } from '@/types/member'
import type { noteOne } from '@/types/note'
import { http } from '@/utils/http'
/**
 * 获取账单明细
 * @param data 请求参数
 */
export type GetDetailDataParams = {
  UserName: string
  DealYear: number
  DealMonth: number
  DealDay: number
  AccountNo: string
  Auth: string
  GoodsType: string
  Goods: string
  InOut: number
  //前年,上年,今年,大前月,前月,上月,本月,本周，上周，前周，大前周
  TimeScope: string
  OrderBy: number
  Require: string
  UserGroup: string
  LoginName: string
}
/**
 * 记账
 * @param data 请求参数
 */
export type NoteParams = {
  UserName: string
  InOut: string
  GoodsType: string
  Goods: string
  Amount: number
  DealTimeStr: string
  Auth: string
  Source: string
  AccountNo: string
  OutAccountNo: string
  InAccountNo: string
  IsNotYuSuan: boolean
  IsAvg: boolean
  IsRequire: boolean
  UserGroup: string
  IsNotMonthAccount: boolean
}
/**
 * 类别
 * @param data 请求参数
 */
export type GetGoodsTypeParams = {
  UserName: string
  Auth: string
}
export const GetDetailDataAPI = (data: GetDetailDataParams) => {
  return http<DataCount[]>({
    method: 'POST',
    url: '/Account/GetData',
    data,
  })
}
export const AppleAddAPI = (data: NoteParams) => {
  return http<{}>({
    method: 'POST',
    url: '/Account/AppleAdd',
    data,
  })
}
export const GetGoodsTypeAPI = (data: GetGoodsTypeParams) => {
  return http<GetGoodsTypeResponse>({
    method: 'POST',
    url: '/Account/GetGoodsType',
    data,
  })
}
/**
 * 获取用户配置
 *
 */
export const GetUserSettingAPI = (data: GetUserSettingRequest) => {
  return http<UserSetting>({
    method: 'POST',
    url: '/User/GetUserSetting',
    data,
  })
}
/**
 * 获取用户配置
 *
 */
export const GetGroupAPI = (data: GetGroupRequest) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/User/GetGroup',
    data,
  })
}
/**
 * 更新用户配置
 *
 */
export const UpdateUserSettingAPI = (data: UserSetting) => {
  return http<{}>({
    method: 'POST',
    url: '/User/UpdateUserSetting',
    data,
  })
}
/**
 * 获取商品详情
 *
 */
export const GetGoodDetailAPI = (data: GetGoodDetailRequest) => {
  return http<AccountDetail>({
    method: 'POST',
    url: '/Account/GetGoodDetail',
    data,
  })
}
/**
 * 删除商品
 *
 */
export const DelGoodAPI = (data: DelGoodRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/Account/DelGood',
    data,
  })
}
export const DropAccountAPI = (data: DropAccountRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/ZiChan/DropAccount',
    data,
  })
}

/**
 * 更新商品
 *
 */
export const UpdateGoodAPI = (data: UpdateGoodRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/Account/UpdateGood',
    data,
  })
}
/**
 * 获取账户列表
 *
 */
export const GetUserAccountAPI = (data: GetUserAccountRequest) => {
  return http<UserAccount[]>({
    method: 'POST',
    url: '/Account/GetUserAccount',
    data,
  })
}
/**
 * 获取账户列表
 *
 */
export const GetAllUserByGroupAPI = (data: Base2UserGroupRequest) => {
  return http<GetAllUserByGroupResponse[]>({
    method: 'POST',
    url: '/User/GetAllUserByGroup',
    data,
  })
}
/**
 * 获取账户类型列表
 *
 */
export const GetAccountTypeNameAPI = (data: Base2UserGroupRequest) => {
  return http<AccountTypeNameResponse[]>({
    method: 'POST',
    url: '/Account/GetAccountTypeName',
    data,
  })
}
/**
 * 获取同类型的账户，如：日常账户、微信、招商
 *
 */
export const GetSameAccountAPI = (data: GetSameAccountRequest) => {
  return http<GetSameAccountResponse[]>({
    method: 'POST',
    url: '/Account/GetSameAccount',
    data,
  })
}
export const GetNoteTypeAPI = (data: Base2UserGroupRequest) => {
  return http<string[]>({
    method: 'POST',
    url: '/Note/GetNoteType',
    data,
  })
}
/**
 * 显示预算
 *
 */
export const ShowYuSuanAPI = (data: ShowYuSuanRequest) => {
  return http<ShowYuSuanResponse>({
    method: 'POST',
    url: '/YuSuan/ShowYuSuan',
    data,
  })
}
//日历视图
export const GetCalendarDataAPI = (data: GetCalendarDataRequest) => {
  return http<GetCalendarDataResponse[]>({
    method: 'POST',
    url: '/Account/GetCalendarData',
    data,
  })
}
export const GetDaKaCalendarDataAPI = (data: GetDaKaCalendarDataRequest) => {
  return http<GetCalendarDataResponse[]>({
    method: 'POST',
    url: '/DaKa/GetDaKaCalendarData',
    data,
  })
}
//通知
export const GetNoticeAPI = (data: GetNoticeRequest) => {
  return http<GetNoticeResponse>({
    method: 'POST',
    url: '/Notice/GetNotice',
    data,
  })
}
//关闭通知
export const CloseNoticeAPI = (data: CloseNoticeRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/Notice/CloseNotice',
    data,
  })
}
